package com.demo.client;

import com.demo.factory.DynamicFeignClientFactory;
import com.demo.service.DynamicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author KingYan
 * @date 2024/7/19
 * @apiNote
 */
@Component
public class DynamicClient {

	@Autowired
	private DynamicFeignClientFactory<DynamicService> dynamicFeignClientFactory;

	public Object executePostApi(String feignName, String url, Object params) {
		DynamicService dynamicService = dynamicFeignClientFactory.getFeignClient(DynamicService.class, feignName);
		return dynamicService.executePostApi(url, params);
	}

	public Object executeGetApi(String feignName, String url, Object params) {
		DynamicService dynamicService = dynamicFeignClientFactory.getFeignClient(DynamicService.class, feignName);
		return dynamicService.executeGetApi(url, params);
	}
}